package sk.vrto.web.base;

import com.google.common.eventbus.EventBus;

//TODO javadoc + unit test
public enum EventBusHolder {

    INSTANCE {
        @Override
        EventBus get() {
            if (null == THREAD_LOCAL_EVENT_BUS.get()) {
                THREAD_LOCAL_EVENT_BUS.set(new EventBus());
            }
            return THREAD_LOCAL_EVENT_BUS.get();
        }
    };

    abstract EventBus get();
    transient private static final ThreadLocal<EventBus> THREAD_LOCAL_EVENT_BUS = new ThreadLocal<>();

}
